

class Solution:

    def isPlindrome(self, head):

        temp = []
        A = head
        while A:
            temp.append(A.val)
            A = A.next

        ans = temp.copy()
        ans.reverse()
        if ans == temp:
            return True
        return False
        # n = len(ans)

        # for i, it in enumerate(temp):
        #     if it != ans[n - 1 - i]:
        #         return False
        # return True
        
        # ans = reH = temp.pop()

        # while temp:
        #     reH.next = temp.pop()
        #     reH = reH.next
        
        # reH.next = None

        # while head and ans:

        #     if head.val != ans.val:
        #         return False
        #     head = head.next
        #     ans = ans.next
        
        # return True

